//
//  YDYAlert.m
//  DY_Bilibili
//
//  Created by 杨德勇 on 2016/10/24.
//  Copyright © 2016年 杨德勇. All rights reserved.
//

#import "YDYAlert.h"
#import <MBProgressHUD.h>
#import <UIKit/UIKit.h>

MBProgressHUD * ydy_SuccessInView(NSString * message , UIView * inView){
    
    MBProgressHUD *hud = [[MBProgressHUD alloc]initWithView:inView];
    hud.label.text = message;
    hud.removeFromSuperViewOnHide  = YES;
    hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"HUDSuccess"]];
    [hud setMode:MBProgressHUDModeCustomView];
    [hud showAnimated:YES];
    [hud hideAnimated:YES afterDelay:1.0];
    [inView addSubview:hud];
    
    return hud;
}


MBProgressHUD * ydy_FailureInView(NSString * message , UIView * inView){
    MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:inView];
    HUD.detailsLabel.text = message;
    HUD.removeFromSuperViewOnHide = YES;
    HUD.mode = MBProgressHUDModeText;
    [inView addSubview:HUD];
    [HUD showAnimated:YES];
    [HUD hideAnimated:YES afterDelay:1.0];
    
    return HUD;
}


MBProgressHUD * ydy_LoadingInView(NSString * message , UIView * inView){
    
        MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:inView];
        HUD.label.text = message;
        HUD.removeFromSuperViewOnHide = YES;
        
        [inView addSubview:HUD];
        [HUD showAnimated:YES];
        return HUD;
}



void ydy_loadingHidden(void);
void ydy_loadingHiddenInView(UIView * inView);
